#include <iostream>
#include "my_shared_ptr.hpp"
#include <memory>
#include <string>
using namespace std;

int test1()
{
    Jaxsen::shared_ptr<string> sp1(new string("yyy"));
    Jaxsen::shared_ptr<string> sp2(new string("xx"));
    cout << *sp1 << endl;
    sp1 = sp2;
    cout << *sp1 << endl;
    auto sp3(sp2);
    cout << *sp3 << endl;
    return 0;
}

/*定制删除器*/
template <class T>
struct DelArray
{
    void operator()(T *ptr)
    {
        delete[] ptr;
    }
};

void test2()
{
    Jaxsen::shared_ptr<int> sp1(new int[10], DelArray<int>());
    Jaxsen::shared_ptr<string> sp2(new string[10], DelArray<string>());
    Jaxsen::shared_ptr<string> sp3(new string("yyy"));
}

int main()
{
    test2();
}